package util;

import static com.google.common.base.Preconditions.checkNotNull;
import metagrammar.Operator;
import metagrammar.OperatorDescription;

public class OperatorWrapper {
    
    private final Operator op;
    private final String name;
    
    public OperatorWrapper(Operator op)
    {
        checkNotNull(op);
        this.op = op;
        name = OperatorDescription.getDescription(op).getName();
    }
    
    public Operator getOperator()
    {
        return op;
    }
    
    @Override
    public String toString()
    {
        return name != null ? name : op.toString();
    }
}